import { Component, OnInit } from '@angular/core';
// 为了从地址栏上获取 传过来的id 值
import{ ActivatedRoute } from '@angular/router'
@Component({
  selector: 'app-newscontent',
  templateUrl: './newscontent.component.html',
  styleUrls: ['./newscontent.component.css']
})
export class NewscontentComponent implements OnInit {

  constructor(public route:ActivatedRoute) { }

  ngOnInit() {
    
    // 1、get 传值
    // this.route.queryParams.subscribe((data)=>{
    //   console.log(data.aid)
    // })

    // 2、动态路由
    console.log(this.route)
    this.route.params.subscribe((data)=>{
      console.log(data.aid)
    })
  }

}
